package org.example;

import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @auther zzyy
 * @create 2023-12-21 17:34
 */
@RestController
@Slf4j
@Tag(name = "支付微服务模块", description = "支付CRUD")
public class PayController {
    @Resource
    private PayService payService;

    @GetMapping(value = "/pay/add")
    public String addPay() {
        return payService.add();
    }

    @DeleteMapping(value = "/pay/del/{id}")
    public String deletePay(@PathVariable("id") Integer id) {
        return payService.delete();
    }

    @PutMapping(value = "/pay/update")
    public String updatePay() {
        return payService.update();
    }

    @GetMapping(value = "/pay/get/{id}")
    public String getById(@PathVariable("id") Integer id) {
        return payService.getById();
    }//全部查询getall作为家庭作业

    @Value("${server.port}")
    private String port;

    @GetMapping(value = "/pay/get/info")
    private String getInfoByConsul(@Value("${atguigu.info}") String atguiguInfo)
    {
        return "8002 atguiguInfo: "+atguiguInfo+"\t"+"port: "+port;
    }
}
